home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / sparc / udiv_qrnnd.S < prev    next >
Text File  |  1994-05-21  |  3KB  |  144 lines

  1. ! SPARC  __udiv_qrnnd division support, used from longlong.h.
  2.  
  3. ! Copyright (C) 1993, 1994 Free Software Foundation, Inc.
  4.  
  5. ! This file is part of the GNU MP Library.
  6.  
  7. ! The GNU MP Library is free software; you can redistribute it and/or modify
  8. ! it under the terms of the GNU Library General Public License as published by
  9. ! the Free Software Foundation; either version 2 of the License, or (at your
  10. ! option) any later version.
  11.  
  12. ! The GNU MP Library is distributed in the hope that it will be useful, but
  13. ! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  14. ! or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
  15. ! License for more details.
  16.  
  17. ! You should have received a copy of the GNU Library General Public License
  18. ! along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
  19. ! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  
  22. ! INPUT PARAMETERS
  23. ! rem_ptr    i0
  24. ! n1        i1
  25. ! n0        i2
  26. ! d        i3
  27.  
  28. #include "sysdep.h"
  29. #undef ret    /* Kludge for glibc */
  30.  
  31.     .text
  32.     .align    8
  33. LC0:    .double    0r4294967296
  34. LC1:    .double    0r2147483648
  35.  
  36.     .align    4
  37.     .global    C_SYMBOL_NAME(__udiv_qrnnd)
  38. C_SYMBOL_NAME(__udiv_qrnnd):
  39.     !#PROLOGUE# 0
  40.     save    %sp,-104,%sp
  41.     !#PROLOGUE# 1
  42.     st    %i1,[%fp-8]
  43.     ld    [%fp-8],%f10
  44.     sethi    %hi(LC0),%o7
  45.     fitod    %f10,%f4
  46.     ldd    [%o7+%lo(LC0)],%f8
  47.     cmp    %i1,0
  48.     bge    L248
  49.     mov    %i0,%i5
  50.     faddd    %f4,%f8,%f4
  51. L248:
  52.     st    %i2,[%fp-8]
  53.     ld    [%fp-8],%f10
  54.     fmuld    %f4,%f8,%f6
  55.     cmp    %i2,0
  56.     bge    L249
  57.     fitod    %f10,%f2
  58.     faddd    %f2,%f8,%f2
  59. L249:
  60.     st    %i3,[%fp-8]
  61.     faddd    %f6,%f2,%f2
  62.     ld    [%fp-8],%f10
  63.     cmp    %i3,0
  64.     bge    L250
  65.     fitod    %f10,%f4
  66.     faddd    %f4,%f8,%f4
  67. L250:
  68.     fdivd    %f2,%f4,%f2
  69.     sethi    %hi(LC1),%o7
  70.     ldd    [%o7+%lo(LC1)],%f4
  71.     fcmped    %f2,%f4
  72.     nop
  73.     fbge,a    L251
  74.     fsubd    %f2,%f4,%f2
  75.     fdtoi    %f2,%f2
  76.     st    %f2,[%fp-8]
  77.     b    L252
  78.     ld    [%fp-8],%i4
  79. L251:
  80.     fdtoi    %f2,%f2
  81.     st    %f2,[%fp-8]
  82.     ld    [%fp-8],%i4
  83.     sethi    %hi(-2147483648),%g2
  84.     xor    %i4,%g2,%i4
  85. L252:
  86.     wr    %g0,%i4,%y
  87.     sra    %i3,31,%g2
  88.     and    %i4,%g2,%g2
  89.     andcc    %g0,0,%g1
  90.     mulscc    %g1,%i3,%g1
  91.     mulscc    %g1,%i3,%g1
  92.     mulscc    %g1,%i3,%g1
  93.     mulscc    %g1,%i3,%g1
  94.     mulscc    %g1,%i3,%g1
  95.     mulscc    %g1,%i3,%g1
  96.     mulscc    %g1,%i3,%g1
  97.     mulscc    %g1,%i3,%g1
  98.     mulscc    %g1,%i3,%g1
  99.     mulscc    %g1,%i3,%g1
  100.     mulscc    %g1,%i3,%g1
  101.     mulscc    %g1,%i3,%g1
  102.     mulscc    %g1,%i3,%g1
  103.     mulscc    %g1,%i3,%g1
  104.     mulscc    %g1,%i3,%g1
  105.     mulscc    %g1,%i3,%g1
  106.     mulscc    %g1,%i3,%g1
  107.     mulscc    %g1,%i3,%g1
  108.     mulscc    %g1,%i3,%g1
  109.     mulscc    %g1,%i3,%g1
  110.     mulscc    %g1,%i3,%g1
  111.     mulscc    %g1,%i3,%g1
  112.     mulscc    %g1,%i3,%g1
  113.     mulscc    %g1,%i3,%g1
  114.     mulscc    %g1,%i3,%g1
  115.     mulscc    %g1,%i3,%g1
  116.     mulscc    %g1,%i3,%g1
  117.     mulscc    %g1,%i3,%g1
  118.     mulscc    %g1,%i3,%g1
  119.     mulscc    %g1,%i3,%g1
  120.     mulscc    %g1,%i3,%g1
  121.     mulscc    %g1,%i3,%g1
  122.     mulscc    %g1,0,%g1
  123.     add    %g1,%g2,%i0
  124.     rd    %y,%g3
  125.     subcc    %i2,%g3,%o7
  126.     subxcc    %i1,%i0,%g0
  127.     be    L253
  128.     cmp    %o7,%i3
  129.  
  130.     add    %i4,-1,%i0
  131.     add    %o7,%i3,%o7
  132.     st    %o7,[%i5]
  133.     ret
  134.     restore
  135. L253:
  136.     blu    L246
  137.     mov    %i4,%i0
  138.     add    %i4,1,%i0
  139.     sub    %o7,%i3,%o7
  140. L246:
  141.     st    %o7,[%i5]
  142.     ret
  143.     restore
  144.